#ifndef __PACKET_H__
#define __PACKET_H__

#include "common.hpp"
#include <sys/types.h>
#include <sys/time.h>


class Packet
{
private:
  byte_t * data;
  int bufLen; 
  int pktLen; // real packet length 
  int capLen; // real captured length (capLen <= pktLen)
  int cursol; // current decoding point
  int remain; // decodable remain data length
  struct timeval tv;

public:
  Packet () : data (NULL), bufLen (0), pktLen (0), capLen (0), cursol (0),
	      remain (0) {}
  Packet (const Packet &p) ;
  ~Packet ();
  Packet &operator=(const Packet &p);

  void setData (byte_t * p, int len, int capLen, struct timeval * tv);
  struct timeval * getTimeval () { return &tv; }
  void * getCur ();
  bool moveCur (int n);
  int getRemain () { return (this->remain - this->cursol); }
  int getPktLen () { return this->pktLen; }
  int getCapLen () { return this->capLen; }
  void setRemain (int n) ;
};

#endif
